package com.lgl.controller;

import com.lgl.dto.*;
import com.lgl.entity.ResponseResult;
import com.lgl.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/content/link")
public class LinkController {
    @Autowired
    private LinkService linkService;
    @GetMapping("/list")
    public ResponseResult getLinkList(Integer pageSize, Integer pageNum, GetLinkListDto getLinkListDto){
        return linkService.getLinkList(pageNum,pageSize,getLinkListDto);
    }
    @PostMapping
    public ResponseResult addLink(@RequestBody AddLinkDto addLinkDto){
        return linkService.addLink(addLinkDto);
    }
    @GetMapping("/{id}")
    public ResponseResult getLink(@PathVariable Long id){
        return linkService.getLink(id);
    }
    @PutMapping
    public ResponseResult updateLink(@RequestBody UpdateLinkDto updateLinkDto){
        return linkService.updateLink(updateLinkDto);
    }
    @DeleteMapping("/{id}")
    public ResponseResult deleteLink(@PathVariable Long id){
        return linkService.deleteLink(id);
    }
    @PutMapping("/changeLinkStatus")
    public ResponseResult changeLinkStatus(@RequestBody ChangeLinkStatusDto changeLinkStatusDto){
        return linkService.changeLinkStatus(changeLinkStatusDto);
    }
}
